#BUILD_TYPE=debug
BUILD_TYPE=release

REPO=/home/pi/csr-repository/lib/

CFLAGS_COMMON = -MD

ifeq ($(BUILD_TYPE), debug)
	CFLAGS = $(CFLAGS_COMMON)
endif
ifeq ($(BUILD_TYPE), release)
	CFLAGS = $(CFLAGS_COMMON) -O3
endif

LDFLAGS = 
LDFLAGS2 = -lX11 -lXext -lrt -lstdc++ 

LSRC = colorThresholding.c
#TSRC = test.c

SRC = $(LSRC) #$(TSRC) 

OBJ = \
      colorThresholding.o \
#      test.o 

LIB = $(REPO)/libcolor_thresholding.so
#TST = test
TARGETS = \
          $(LIB) \
#          $(TST) 


all: $(TARGETS)


#%.o: %.c
#	gcc -c $(CFLAGS) $< -o $@

colorThresholding.o: colorThresholding.c
	gcc -c colorThresholding.c $(CFLAGS)
	
$(LIB): $(OBJ)
	gcc -shared  -o $@  colorThresholding.o

#$(TST): test.o
#	gcc $+ -lcolor_thresholding -lstdc++ -o test

clean:
	rm -f TST *.d *.o 

-include $(OBJS)/*.d
